package com.example.japinhands.ui.screen

import androidx.compose.foundation.layout.Column
import androidx.compose.foundation.layout.fillMaxWidth
import androidx.compose.material3.Button
import androidx.compose.material3.ExperimentalMaterial3Api
import androidx.compose.material3.Text
import androidx.compose.material3.TextField
import androidx.compose.runtime.Composable
import androidx.compose.runtime.getValue
import androidx.compose.runtime.mutableStateOf
import androidx.compose.runtime.remember
import androidx.compose.runtime.setValue
import androidx.compose.ui.Modifier
import com.example.japinhands.JapViewModel
import com.example.japinhands.data.Word
import kotlin.concurrent.thread

@OptIn(ExperimentalMaterial3Api::class)
@Composable
fun TestUpdateWordScreen(
    viewModel: JapViewModel,
    word: Word
) {
    var newKanji by remember {
        mutableStateOf("")
    }
    Column {
        Text(text = word.kanji)
        Text(text = word.gana)
        Text(text = word.meaning)
        Text(text = word.notice)
        Text(text = word.sentenceContent)
        TextField(
            modifier = Modifier.fillMaxWidth(),
            value = newKanji,
            onValueChange = { newKanji = it }
        )
        Button(onClick = {
            thread {
//                viewModel.updateWord(word.copy(kanji = newKanji))
            }
        }) {
            Text(text = "提交")
        }
    }
}